#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int get_lucky_packets(vector<int>& x, int n, int pos, int sum, int multi)
{
    int count = 0;
  
    for(size_t i = pos; i < n; i++)
    {
        sum += x[i];
        multi *= x[i];

        if(sum > multi)
            count += 1 + get_lucky_packets(x, n, i + 1, sum, multi);
        else if(x[i] == 1)
            count += get_lucky_packets(x, n, i + 1, sum, multi);
        else 
            break;

        sum -= x[i];
        multi /= x[i];

        while(i < n - 1 && x[i] == x[i + 1])
            i++;
    }

    return count;
}


int main() {
    int n;
    cin >> n;
    vector<int> v;
    v.reserve(n);
    for(size_t i = 0; i < n; i++)
    {
        int tmp;
        cin >> tmp;
        v.push_back(tmp);
    }

    sort(v.begin(), v.end());
    cout << get_lucky_packets(v, n, 0, 0, 1) << endl;

    return 0;
}